﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;

namespace Road3App.Services
{
    public static class DialogService
    {
        private static string Show<T>() where T : FileDialog, new()
        {
            T dlg = new T();
            dlg.AddExtension = true;
            dlg.DefaultExt = ".xml";
            dlg.Filter = "XML|*.xml";

            return dlg.ShowDialog() == true ? dlg.FileName : string.Empty;
        }

        public static string Open()
        {
            return Show<OpenFileDialog>();
        }

        public static string Save()
        {
            return Show<SaveFileDialog>();
        }
    }
}
